function init() {
  loadCity();
}

function loadCity() {
  var req = opensocial.newDataRequest();
  var params = {};
  params[opensocial.DataRequest.PeopleRequestFields.PROFILE_DETAILS] =
        [opensocial.Person.Field.CURRENT_LOCATION];

  req.add(req.newFetchPersonRequest(opensocial.DataRequest.PersonId.VIEWER,
		params), 'viewer'); 
  req.send(onLoadCity);
}

function onLoadCity(data) {
  var viewer = data.get('viewer').getData();
  alert('srihari');
  alert(viewer);
  var address = viewer.getField(opensocial.Person.Field.CURRENT_LOCATION);
  alert(address);
  var country = address.getField(opensocial.Address.Field.LOCALITY);
  alert(country);
  html = new Array();
  html.push('<ul>');
  
    html.push('<li>' + country + "</li>");
  
  html.push('</ul>');
  document.getElementById('city').innerHTML = html.join('');
}